home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / C64 / M-More Monthly Disks / (c)md.d64 / dungeon.c (.txt) < prev    next >
Commodore BASIC  |  2007-02-04  |  8KB  |  267 lines

  1. 5 REM ** DUNGEON OF DEATH **
  2. 7 REM ** BY BRAD LEYPOLD **
  3. 10 POKE52,56:POKE56,56:CLR
  4. 20 POKE53280,0:POKE53281,0
  5. 30 PRINT"[147][156]DUNGEON OF DEATH"
  6. 35 PRINT"BY BRAD LEYPOLD"
  7. 40 PRINT"PLEASE WAIT"
  8. 45 REM ** DEFINE CHARACTERS, SPRITES **
  9. 50 POKE56334,PEEK(56334)AND254:POKE1,PEEK(1)AND251
  10. 60 FORI=14336TO14336+256*8:POKEI,PEEK(I+38912):NEXT
  11. 70 POKE1,PEEK(1)OR4:POKE56334,PEEK(56334)OR1
  12. 80 FORI=14336+64*8TO14336+75*8:READA:POKEI,A:NEXT
  13. 90 FORI=832TO1023:READA:IFA=-1THEN93
  14. 91 POKEI,A
  15. 93 NEXTI
  16. 95 REM ** DEFINE VARIABLES **
  17. 99 GOSUB2800
  18. 100 PRINT"[147]";:FORI=2TO16:POKE53280,I:POKE53281,I:FORI2=1TO25:NEXT:NEXT
  19. 102 PRINT"[147]BEWARE !":FORI=1TO200:NEXT
  20. 103 S=1024:C=54272:V=53248:CM=55296
  21. 105 T(0)=0:T(1)=3000:T(2)=3:FF=0
  22. 110 A=0:DEFFNPS(A)=S+X+40*Y
  23. 120 ZZ=80:FORI=1TO4:A=INT(RND(1)*38+1):DI(I)=A+S+ZZ:ZZ=ZZ+80:NEXT
  24. 128 FU(1)=120:FU(2)=200:FU(3)=280
  25. 130 FORI=1TO3:WR(I)=INT(RND(1)*38+1):DEFFNW(I)=S+FU(I)+WR(I)
  26. 131 NEXT
  27. 140 FORI=1TO4:DEFFNGB(I)=S+X(I)+40*Y(I):NEXT
  28. 145 A=1
  29. 150 DEFFNSX(A)=X*8+24:DEFFNSY(A)=Y*8+50
  30. 160 X=3:Y=2:FORI=1TO4:X(I)=INT(RND(1)*38)+1:Y(I)=INT(RND(1)*8)+10:NEXT
  31. 170 D1=1:D2=-1:L1=14:L2=15
  32. 175 PP=64
  33. 190 V0=213:V1=213:V2=202
  34. 200 H0=170:H1=84:H2=254
  35. 210 PRINT"[147]";
  36. 211 FORI=0TO24:POKEC+I,0:NEXT
  37. 215 POKEC,15:POKEC+6,240:POKEC+24,15
  38. 217 GOSUB2400
  39. 220 POKEV+24,(PEEK(V+24)AND240)+14
  40. 230 POKEV+22,PEEK(V+22)OR16
  41. 240 POKEV+34,2:POKEV+35,5
  42. 250 GOSUB1200:GOSUB1300:GOSUB1500
  43. 295 REM ** WALLS **
  44. 300 GOSUB1200
  45. 310 GOSUB1700
  46. 315 PE=PEEK(FNPS(0))
  47. 317 POKEC+4,32
  48. 320 IFPE=66ORPE=67GOTO1800
  49. 335 IFPE=68THENGOSUB1900:GOSUB2420
  50. 340 POKEFNPS(0),PP:POKEFNPS(0)+C,3
  51. 350 GOSUB2000
  52. 360 FF=FF+1:IFFF=20THENT(1)=T(1)-100:FF=0
  53. 365 IFFNPS(0)=S+420THENGOSUB2050:GOTO400
  54. 370 GOTO300
  55. 400 REM ** GOBLINS **
  56. 405 ES=0
  57. 410 GOSUB1200:GOSUB1700
  58. 420 A=INT(RND(1)*KK)+1:POKEC+4,32
  59. 425 IFA>4THENGOTO520
  60. 430 POKEFNGB(A),32:POKEFNGB(A)+C,0
  61. 435 IFX<X(A)THENX(A)=X(A)-1
  62. 440 IFX>X(A)THENX(A)=X(A)+1
  63. 450 IFY<Y(A)THENY(A)=Y(A)-1
  64. 455 POKEC+11,33
  65. 460 IFY>Y(A)THENY(A)=Y(A)+1
  66. 465 POKEC+11,32
  67. 470 PE=PEEK(FNGB(A))
  68. 480 IFPE=66ORPE=67ORPE=73ORPE=69ORPE=70THENGOSUB2100
  69. 500 POKEFNGB(A),73:POKEFNGB(A)+C,12
  70. 520 PE=PEEK(FNPS(0))
  71. 530 IFPE=66ORPE=67ORPE=73GOTO1800
  72. 560 IFPE=69ORPE=70THENT(0)=T(0)+250:ES=ES+1:GOSUB2420
  73. 570 POKEFNPS(0),PP:POKEFNPS(0)+C,3
  74. 580 IFES=2THENPOKES+740,32:POKECM+740,0
  75. 585 FF=FF+1:IFFF=20THENT(1)=T(1)-100:FF=0
  76. 590 IFFNPS(0)=S+780GOTO600
  77. 595 GOTO410
  78. 600 REM ** SPIRITS **
  79. 601 SF=0
  80. 602 ES=0
  81. 603 GOSUB2050
  82. 604 FORI=S+720TOS+759:POKEI,66:POKEI+C,14:NEXT
  83. 605 POKEV+31,0
  84. 610 GOSUB1200:GOSUB1700
  85. 620 V1=V1+D2:V2=V2+D1
  86. 630 L1=L1+1:L2=L2+1:IFL1=16THENL1=14
  87. 635 POKEC+4,32
  88. 640 IFL2=16THENL2=14
  89. 650 POKE2041,L1:POKE2042,L2
  90. 660 IFV1=213ORV2=213THEND2=-D2:D1=-D1
  91. 670 POKEV+3,V1:POKEV+5,V2
  92. 680 IFFNSY(1)<PEEK(V+1)THENA=-1
  93. 690 IFFNSY(1)>PEEK(V+1)THENA=1
  94. 700 IFFNSX(1)<(PEEK(V)+(-SF*256))THENA1=-1
  95. 710 IFFNSX(1)>(PEEK(V)+(-SF*256))THENA1=1
  96. 720 V0=V0+A:H0=H0+A1:IFV0=214THENV0=213
  97. 725 SF=(H0>255)
  98. 730 POKEV+1,V0
  99. 740 POKEV,H0+(SF*256):POKEV+16,SF*(-1)
  100. 742 PE=PEEK(FNPS(0))
  101. 744 IFPE=66ORPE=67GOTO1800
  102. 746 IFPE=71ORPE=72THENT(0)=T(0)+500:ES=ES+1:GOSUB2420
  103. 748 IFES=2THENGOTO2200
  104. 750 POKEFNPS(0),PP:POKEFNPS(0)+C,3
  105. 760 SC=PEEK(V+31)
  106. 770 IF(SCAND1)GOTO1800
  107. 780 IF(SCAND2)GOTO1800
  108. 790 IF(SCAND4)GOTO1800
  109. 795 FF=FF+1:IFFF=20THENT(1)=T(1)-100:FF=0
  110. 800 GOTO605
  111. 1195 REM ** SCORING ROUTINE **
  112. 1200 PRINT"[159]SCORE:";T(0);"[157] BONUS: ";T(1);"[158][157] MEN: ";T(2)
  113. 1210 RETURN
  114. 1295 REM ** DRAW SCREEN **
  115. 1300 FORI=S+40TOS+79:POKEI,66:POKEI+C,14:NEXT
  116. 1310 FORI=S+920TOS+959:POKEI,66:POKEI+C,14:NEXT
  117. 1320 FORI=S+40TOS+920STEP40:POKEI,66:POKEI+C,14:NEXT
  118. 1330 FORI=S+79TOS+959STEP40:POKEI,66:POKEI+C,14:NEXT
  119. 1340 A=S+120:FORI=1TO3:FORI2=1TO38:POKEA+I2,67:POKEA+I2+C,11:NEXT
  120. 1345 A=A+80:NEXT
  121. 1350 FORI=S+360TOS+399:POKEI,66:POKEI+C,14:NEXT:POKES+380,32:POKECM+380,0
  122. 1360 FORI=S+720TOS+759:POKEI,66:POKEI+C,14:NEXT:POKES+740,32:POKECM+740,0
  123. 1370 POKES+419,66:POKECM+419,14:POKES+421,66:POKECM+421,14
  124. 1380 POKES+779,66:POKECM+779,14:POKES+781,66:POKECM+781,14
  125. 1385 POKES+740,66:POKECM+740,14
  126. 1390 POKES+485,67:POKECM+485,11:POKES+605,67:POKECM+605,11
  127. 1400 POKES+570,67:POKECM+570,11
  128. 1410 POKES+500,67:POKECM+500,11:POKES+660,67:POKECM+660,11
  129. 1420 POKES+578,67:POKECM+578,11:POKES+582,67:POKECM+582,11
  130. 1430 POKES+589,67:POKECM+589,11
  131. 1440 POKES+514,67:POKECM+514,11:POKES+634,67:POKECM+634,11
  132. 1450 RETURN
  133. 1495 REM ** PLACE OBJECTS, PEOPLE **
  134. 1500 POKEFNPS(0),64:POKEFNPS(0)+C,3
  135. 1510 FORI=1TO4:POKEDI(I),68:POKEDI(I)+C,1:NEXT
  136. 1520 FORI=1TO4:POKEFNGB(I),73:POKEFNGB(I)+C,12:NEXT
  137. 1530 FORI=1TO3:POKEFNW(I),32:POKEFNW(I)+C,0:NEXT
  138. 1540 POKES+522,69:POKECM+522,7:POKES+557,70:POKECM+557,7
  139. 1550 POKES+842,71:POKECM+842,2:POKES+877,72:POKECM+877,2
  140. 1560 POKE2040,13:POKE2041,14:POKE2042,15
  141. 1570 POKEV+39,8:POKEV+40,1:POKEV+41,1
  142. 1580 POKEV,H0:POKEV+2,H1:POKEV+4,H2
  143. 1590 POKEV+1,V0:POKEV+3,V1:POKEV+5,V2
  144. 1600 POKEV+21,7
  145. 1630 RETURN
  146. 1695 REM ** JOYSTICK **
  147. 1700 JR=PEEK(56320)
  148. 1710 HD=SGN(JRAND4)-SGN(JRAND8)
  149. 1720 VD=SGN(JRAND1)-SGN(JRAND2)
  150. 1725 IFHD<>0ORVD<>0THENPP=PP+1:POKEFNPS(0),32:POKEFNPS(0)+C,0:IFPP=66THENPP=64
  151. 1727 IFHD<>0ORVD<>0THENGOSUB2450
  152. 1730 X=X+HD:Y=Y+VD
  153. 1740 RETURN
  154. 1800 POKEC,8:POKEC+1,98:POKEC+6,247
  155. 1803 POKEC+4,129:POKEFNPS(0),PP
  156. 1804 FORI=1TO75:POKEFNPS(0)+C,I:NEXT:POKEC+4,128
  157. 1805 T(2)=T(2)-1:IFT(2)=0THEN2900
  158. 1810 POKEV+21,0:FF=0:T(1)=3000:GOTO110
  159. 1900 FORI=1TO4:IFFNPS(0)=DI(I)THENPOKEDI(I),32:POKEDI(I)+C,0:T(0)=T(0)+100:I=4
  160. 1910 NEXT:RETURN
  161. 2000 FORI=1TO3:WR(I)=WR(I)+1:IFWR(I)=41THENWR(I)=2:GOSUB2025
  162. 2010 POKEFNW(I),32:POKEFNW(I)+C,0:POKEFNW(I)-2,67:POKEFNW(I)+C-2,11
  163. 2020 IFFNW(I)-2=FNPS(0)THEN1800
  164. 2021 NEXT:RETURN
  165. 2025 POKES+FU(I)+39,67:POKECM+FU(I)+39,11
  166. 2030 POKES+FU(I)+40,66:POKECM+FU(I)+40,14:RETURN
  167. 2050 POKEFNPS(0)-40,66:POKEFNPS(0)+C-40,14
  168. 2055 POKEFNPS(0)-1,32:POKEFNPS(0)+C-1,0:POKEFNPS(0)+1,32:POKEFNPS(0)+C+1,0
  169. 2060 RETURN
  170. 2100 POKEFNGB(A)-1,32:POKEFNGB(A)+C-1,0
  171. 2105 POKEC+11,33:FORI2=67TO37STEP-1:POKEC+8,I2:FORI3=1TO5:NEXT:NEXT
  172. 2106 POKEC+11,32:GOSUB2400
  173. 2110 X(A)=INT(RND(1)*38)+1:Y(A)=INT(RND(1)*8)+10
  174. 2120 POKEFNGB(A),73:POKEFNGB(A)+C,13
  175. 2130 RETURN
  176. 2200 REM ** RING FOUND **
  177. 2201 PRINT"[147]":POKEV+21,0
  178. 2205 T(0)=T(0)+T(1)
  179. 2210 PRINT"[156][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209]"
  180. 2220 PRINT"RING OF POWER FOUND"
  181. 2230 PRINT"[156]DUNGEON OF DEATH DESTROYED"
  182. 2235 PRINT"[159]CONGRADULATIONS"
  183. 2240 PRINT"[158]FINAL SCORE: ";T(0)
  184. 2250 IFT(0)=>4500THENA$="WARRIOR KING"
  185. 2260 IFT(0)<=4499THENA$="HONORABLE KNIGHT"
  186. 2270 IFT(0)<=3750THENA$="COMMON FIGHTER"
  187. 2280 IFT(0)<=2500THENA$="LUCKY SIGHTSEER"
  188. 2290 PRINT"[159]THIS GIVES YOU THE RANK OF A "
  189. 2295 PRINT"";A$
  190. 2300 PRINT"[156][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][209][145][145][145][145][145][156]"
  191. 2303 POKEC,49:POKEC+1,16:POKEC+5,32:POKEC+6,250
  192. 2304 POKEC+7,15:POKEC+8,32:POKEC+12,32:POKEC+13,67
  193. 2305 POKEC+2,64:POKEC+3,10
  194. 2307 POKEC+11,33:POKEC+4,65:FORI=1TO400:NEXT:POKEC+4,64:POKEC+11,32
  195. 2310 GOTO2910
  196. 2400 POKEC+7,15:POKEC+8,67:POKEC+13,240:RETURN
  197. 2420 POKEC+7,30:POKEC+8,137:POKEC+11,33:FORI=1TO50:NEXT:POKEC+11,32
  198. 2425 GOSUB2400:RETURN
  199. 2450 POKEC+4,33:POKEC+1,16:RETURN
  200. 2800 REM ** INSTRUCTIONS **
  201. 2805 PRINT"[147]";
  202. 2810 PRINT"YOU ARE ARNIE THE ADVENTURER. YOUR"
  203. 2815 PRINT"QUEST IS TO FIND THE RING OF POWER. YOU"
  204. 2820 PRINT"SEEM TO HAVE FORGOT YOUR WEAPONS SO ALL"
  205. 2825 PRINT"HAVE IS YOUR WITS AND REFLEXES."
  206. 2830 PRINT"YOUR FIRST CHALLENGE IS TO PASS THE"
  207. 2835 PRINT"MOVING WALLS. YOU CAN PICK UP THE"
  208. 2840 PRINT"DIAMONDS ALONG THE WAY, THEY'RE WORTH"
  209. 2845 PRINT"100 POINTS EACH"
  210. 2850 PRINT"NEXT YOU MUST AVOID THE GOBLINS. YOU"
  211. 2855 PRINT"ALSO MUST PICK UP THE TWO PIECES OF THE"
  212. 2860 PRINT"KEY. THEY ARE WORTH 250 POINTS EACH."
  213. 2865 PRINT"AFTER YOU GET THE TWO PIECES OF THE"
  214. 2870 PRINT"KEY YOU MUST GET THE TWO PIECES OF THE"
  215. 2875 PRINT"RING. IF THE EVIL SPIRIT OR ONE OF THE"
  216. 2880 PRINT"GHOULS TOUCHES YOU, YOU WILL DIE. EACH"
  217. 2885 PRINT"OF THE PIECES IS WORTH 500 POINTS"
  218. 2890 PRINT"YOUR BONUS TIME COUNTS DOWN FROM 3000"
  219. 2891 PRINT"POINTS. USE A JOYSTICK IN PORT#2"
  220. 2893 PRINT"SKILL LEVEL? (1-HARD...4-EASY)"
  221. 2894 GETA$:IFA$=""THEN2894
  222. 2895 KK=VAL(A$):IFKK<1ORKK>4THEN2894
  223. 2896 KK=KK+3:RETURN
  224. 2900 FORI=1TO200:NEXT
  225. 2905 PRINT"[159]GAME OVER"
  226. 2907 POKEC+4,33:FORI=67TO1STEP-1:POKEC+1,I:FORI2=1TO3:NEXT:NEXT:POKEC+4,32
  227. 2910 PRINT"PLAY AGAIN (Y/N)?"
  228. 2930 GETA$:IFA$=""THENGOTO2930
  229. 2940 IFA$="Y"THENPRINT"[147]":POKEV+21,0:CLR:GOSUB2893:PRINT"[147]";:GOTO100
  230. 2950 IFA$="N"THENGOTO2960
  231. 2955 GOTO2930
  232. 2960 POKEV+24,21:POKEV+22,PEEK(V+22)AND239:POKEV+21,0:PRINT"[147][155]":END
  233. 2995 REM ** CHAR DATA **
  234. 3000 DATA 60,60,216,126,27,60,38,96
  235. 3010 DATA 60,60,27,126,216,60,100,6
  236. 3020 DATA 170,143,82,143,82,143,82,170
  237. 3030 DATA 0,60,170,130,255,65,85,60
  238. 3040 DATA 0,24,60,102,195,102,60,24
  239. 3050 DATA 48,96,192,112,24,120,24,248
  240. 3060 DATA 28,6,3,14,24,30,24,31
  241. 3070 DATA 120,56,24,96,128,128,96,24
  242. 3080 DATA 30,28,24,6,1,1,6,24
  243. 3090 DATA 195,195,0,40,0,65,20,0
  244. 3095 DATA 0,0,0,0,0,0,0,0
  245. 3100 REM ** SPRITE DATA **
  246. 3110 DATA 0,0,0,0,4,0,32,6,0,96
  247. 3120 DATA 7,0,224,3,129,192,0,0,0
  248. 3130 DATA 0,24,0,0,24,0,0,60,0
  249. 3140 DATA 0,90,0,0,0,0,16,0,8
  250. 3150 DATA 24,0,24,12,0,48,6,0,96
  251. 3160 DATA 3,129,192,0,255,0,0,60,0
  252. 3170 DATA 0,0,0,0,0,0,0,0,0,-1
  253. 3180 DATA 0,60,0,0,90,0,0,102,0
  254. 3190 DATA 0,66,0,0,60,0,7,24,0
  255. 3200 DATA 13,152,8,24,255,24,48,25,176
  256. 3210 DATA 0,24,224,0,24,0,0,255,0
  257. 3220 DATA 0,195,0,0,195,0,0,195,0
  258. 3230 DATA 0,195,0,0,195,128,0,195,192
  259. 3240 DATA 0,192,0,1,192,0,3,192,0,-1
  260. 3250 DATA 0,60,0,0,90,0,0,102,0
  261. 3260 DATA 0,66,0,0,60,0,0,24,224
  262. 3270 DATA 48,25,176,24,255,24,13,152,12
  263. 3280 DATA 7,24,0,0,24,0,0,255,0
  264. 3290 DATA 0,195,0,0,195,0,0,195,0
  265. 3300 DATA 0,195,0,1,195,0,3,195,0
  266. 3310 DATA 0,3,0,0,3,128,0,3,192,0,0,-1
  267.